﻿using System.Runtime.Serialization;
using System.ServiceModel;
using System.Data;

namespace WcfServiceParsingSite
{
    // ПРИМЕЧАНИЕ. Команду "Переименовать" в меню "Рефакторинг" можно использовать для одновременного изменения имени интерфейса "IServParsSite" в коде и файле конфигурации.
    [ServiceContract]
    public interface IServParsSite
    {
        [OperationContract]
        int NewClient(string ip,string comment,DataTable files,int pharmCode,string windowsInfo);

        [OperationContract]
        WorkPlanStr IAmFree(int clientid);

        [OperationContract]
        void CompPriceIns(DataTable comprice, int wpstrid, int clientid);

        [OperationContract]
        void ClientIPUpd(int clientid,string newip);

        [OperationContract]
        void ClientWinInfoUpd(int clientid, string windowsInfo);

        [OperationContract]
        FileNameVersion GetInstallerInfo();

        [OperationContract]
        FileNameVersion GetWinServiceInfo();

        [OperationContract]
        void ClientFileVersionUpd(int clientid,string falename,string fileversion);

        [OperationContract]
        void ClientPharmCodeUpd(int clientid, int pharmCode);

        //*******передача файлов**********///
        [OperationContract]
        string[] GetFilesNames();

        [OperationContract]
        int GetFileChunksCount(string name);

        [OperationContract]
        string GetFileChunk(string name, int chunkNumber);
    }

    [DataContract]
    public class WorkPlanStr
    {
        string urlPath = "";
        string urlParam = "";
        string drug = "";
        int workPlanStrID = 0;
        int webSiteID = 0;

        [DataMember]
        public string UrlPath
        {
            get { return urlPath; }
            set { urlPath = value; }
        }

        [DataMember]
        public string UrlParam
        {
            get { return urlParam; }
            set { urlParam = value; }
        }

        [DataMember]
        public string Drug
        {
            get { return drug; }
            set { drug = value; }
        }

        [DataMember]
        public int WorkPlanStrID
        {
            get { return workPlanStrID; }
            set { workPlanStrID = value; }
        }

        [DataMember]
        public int WebSiteID
        {
            get { return webSiteID; }
            set { webSiteID = value; }
        }
    }

    [DataContract]
    public class FileNameVersion
    {
        string fileName = "";
        string fileVersion = "";
        int fileID= 0;

        [DataMember]
        public string FileName
        {
            get { return fileName; }
            set { fileName = value; }
        }

        [DataMember]
        public string FileVersion
        {
            get { return fileVersion; }
            set { fileVersion = value; }
        }

        [DataMember]
        public int Fileid
        {
            get { return fileID; }
            set { fileID = value; }
        }
    }
    
}
